package org.example.demo.contorller;

import org.example.vo.DemoProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

// SpringMVC 控制器 相当于 Servlet
@RestController
public class DemoController {

    @Value("张三")
    String name;

    // Spring表达式引入配置值
    @Value("${demo.name}")
    String demoName;

    @RequestMapping("name")
    String myName(){
        return name + "   " + demoName;
    }

    @Autowired
    DemoProperties properties;

    @RequestMapping("props")
    DemoProperties props(){
        return properties;
    }

}
